#!/usr/bin/env bash

echo "To change..."
echo "*************************"
find . -name "*.cpp" | xargs grep -e '^#define DEBUG true$'
echo "*************************"
files=( $(find . -name "*.cpp" | xargs grep -e '^#define DEBUG true$' | awk -F: '{print $1}') )

find . -name "*.cpp" |xargs sed -i 's/^\(#define DEBUG\) true/\1 false/'

echo "After change..."
# 验证
echo "*************************"
for f in "${files[@]}"
do
    grep -e '^#define DEBUG ' $f
done
echo "*************************"
